Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nice_things/io/echo.sh

echo

Since 0.3.0 · Source

import "{ echo }" from nice_things/io/echo.sh

Synopsis
echo [<message>…]

Configuration

Description
Portable echo that takes no options for consistent behavior across shells.

Just like the echo shell builtin command, this function prints the <message> arguments, separated by a space character when many arguments are used, and terminated with a line-feed character.

This function exists because POSIX echo is poorly specified and has inconsistent behavior across shells. You should prefer the printf builtin command for consistent behavior, but if you must use echo, this function makes it consistent.

Options

Operands
<message>: An optional message to print.

Stdin

Stdout
The message is printed to stdout.

Stderr

Exit status
0: Successful completion.

Abort

Usage examples

echo "Some text"